unit ExcelRpt;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBClient, alBaseDataSet, MConnect, EXLReportExcelTLB,
  DBBaseRpt, EXLReportBand, EXLReport, EXLReportDictionary;

type
  TrptExcel = class(TrptDBBase)
    rptMain: TEXLReport;
  private
    { Private declarations }
  protected
    procedure Initialize; override;
    procedure Loaded; override;
  public
    procedure Execute; override;
  end;

var
  rptExcel: TrptExcel;

implementation

{$R *.dfm}

{ TrptExcel }

procedure TrptExcel.Execute;
begin
  inherited;
  rptMain.Show();
end;

procedure TrptExcel.Initialize;
var
  ReportField: TExlReportField;
begin
  inherited;
  ReportField := rptMain.Dictionary.Add;
  ReportField.FieldName := 'Title';
  ReportField.ValueAsString := ReportTitle;
end;

procedure TrptExcel.Loaded;
begin
  inherited;
  if rptMain.Template <> '' then
    rptMain.Template := ReportPath + ExtractFileName(rptMain.Template);
end;

end.
